package com.youhui.weixin.dao;

import com.youhui.weixin.domain.Types;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
import java.util.List;

/**
 * Created by https://github.com/kuangcp on 17-9-26  下午5:10
 */
@RepositoryRestResource(path = "types")
public interface TypesDao extends JpaRepository<Types, Long> {

    /**
     * 获取首页分类.
     * @return 分类信息.
     */
    @Query("select t from Types t where t.homePage = 1")
    List<Types> getHomeTypes();

    @Query("select t from Types t where t.typeId = ?1")
    Types getTypesById(int typeId);

}
